package com.hui.platform.falseworkapi.common.security.configurer;

import com.hui.platform.falseworkapi.common.security.base.IBasicHttpSecurityConfigurer;
import com.hui.platform.falseworkapi.common.security.constant.SecurityConstant;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.stereotype.Component;

/**
 * Actuator 安全路径配置
 *
 * @author Peng
 * @date 2019/12/12
 */
@Component
public class ActuatorBasicHttpSecurityConfigurer implements IBasicHttpSecurityConfigurer {

    @Override
    public void configure(HttpSecurity http) throws Exception {
        //规则
        String patterns = "/actuator/**";
        //选择匹配器
        http.requestMatchers().antMatchers(patterns);
        //权限解决器
        http.authorizeRequests().antMatchers(patterns).hasRole(SecurityConstant.SYSTEM_DEV);
    }
}
